/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myfx.jfxpanel;

import brain.MyBrain;
import controller.MyController;
import java.awt.Dimension;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;

/**
 *
 * @author Administrator
 */
public class MyStatus extends JFXPanel{
    private int width;
    private int height;
    private MyController controller;
    private MyBrain brain;
    private Color color;
    private final Label zhuangtaiLabel=new Label("现在程序所处状态");
    private final Label guangbiaoxzLabel=new Label("当前位置");
    private final Label bianjiztLabel=new Label("是否处于编辑状态");
    private final Label beizhuLabel=new Label("这里是钻孔备注");
    public MyStatus(int width,int height,Color color){
        this.width=width;
        this.height=height;
        this.color=color;
        this.setPreferredSize(new Dimension(width, height));      
        //这是编辑状态的另一种可选操作
    }
    public void addController(MyController controller){
                this.controller=controller;
                
    }
    public void addBrain(MyBrain brain){
        this.brain=brain;
    }
    public void createStatus(){
        
        String cssDefault = "-fx-border-color: black;\n" 
        + "-fx-border-insets: 5;\n" 
        + "-fx-border-width: 3;\n" 
        ;                                        //  + "-fx-border-style: dashed;\n"
        zhuangtaiLabel.setStyle(cssDefault);
        guangbiaoxzLabel.setStyle(cssDefault);
        bianjiztLabel.setStyle(cssDefault);
        beizhuLabel.setStyle(cssDefault);
        //
        zhuangtaiLabel.setPrefWidth(300);
        guangbiaoxzLabel.setPrefWidth(300);
        bianjiztLabel.setPrefWidth(300);
        beizhuLabel.setPrefWidth(300);
        zhuangtaiLabel.setTextFill(Color.RED);
        guangbiaoxzLabel.setTextFill(Color.RED);
        bianjiztLabel.setTextFill(Color.RED);
        beizhuLabel.setTextFill(Color.RED);
//        zhuangtaiLabel.setFont(new Font(18));
        
        Group root=new Group();
        ImageView back=new ImageView(new Image("myfx/jfxpanel/status_bk_1.png"));
        back.setTranslateY(-3);
        root.getChildren().add(back);
        
        HBox hBox=new HBox();
        hBox.getChildren().addAll(zhuangtaiLabel,guangbiaoxzLabel,bianjiztLabel,beizhuLabel);
        hBox.setPrefSize(width, height);
        hBox.setTranslateY(-3);
        root.getChildren().add(hBox);
        
        Scene statuScene=new Scene(root, 1366, 25, Color.WHITE);
        this.setScene(statuScene);
    }
    public synchronized void updateStatus(String zhuangtai,String guangbiaoxz,String bianjizt,String beizhu){
        zhuangtaiLabel.setText(zhuangtai);
        guangbiaoxzLabel.setText(guangbiaoxz);
        bianjiztLabel.setText(bianjizt);
        beizhuLabel.setText(beizhu);
        
    }

}
